package com.niiwoo.civet.trade.dao.mapper;

import com.niiwoo.civet.trade.dao.entity.RefundWithholdOrder;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface RefundWithholdOrderMapperExt extends RefundWithholdOrderMapper
{


    /**
     * 还款中的订单
     * @param projectId
     * @return
     */
    int countRefunding(Long projectId);

    /**
     * 当天还款成功的订单
     * @param projectId
     * @return
     */
    int countRefundSuccess(Long projectId);

    /**
     * 查询处理中的订单
     * @param projectId
     * @return
     */
    int countWithholdSuccess(@Param("projectId") Long projectId);
    /**
     * 查询处理中的订单
     * @param projectId
     * @return
     */
    int countWithholdProcessing(@Param("projectId") Long projectId);


    /**
     * 查询状态处理中的订单
     * @return
     */
    List<RefundWithholdOrder> listProcessing();

    RefundWithholdOrder selectByPrimaryKeyForUpdate(Long id);

    RefundWithholdOrder selectByProjectIdAndOrgRequestNo(@Param("projectId") Long projectId, @Param("orgRequestNo") String orgRequestNo);
    
    /**
     * 根据还款订单ID查询代扣订单
     * 
     * @param refundOrderId
     * @return
     */
    RefundWithholdOrder selectByRefundOrderId(@Param("refundOrderId") Long refundOrderId);

    /**
     * 代扣成功，但是还款处理超过一个小时
     * @return
     */
    List<RefundWithholdOrder> selectHandingOverTimeOrders();

}